﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace TGIApp.Data
{
    public static class ObjectContextFactory
    {
        /// <summary>
        /// Gets the default ObjectContext for the project
        /// </summary>
        /// <returns>The default ObjectContext for the project</returns>
        public static Entities GetContext()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["TicketAppDB"].ConnectionString;

            return GetContext(connectionString);
        }

        /// <summary>
        /// Gets the default ObjectContext for the project
        /// </summary>
        /// <param name="connectionString">Connection string to use for database queries</param>
        /// <returns>The default ObjectContext for the project</returns>
        public static Entities GetContext(string connectionString)
        {
            return new Entities(connectionString);
        }
    }

}
